package com.project3.bean;


import com.project3.annotations.Constraints;
import com.project3.annotations.DBTable;
import com.project3.annotations.SQLType;

@DBTable(name="Product153")
public class Product {
	@SQLType(dbtype="int",constraints=@Constraints(primaryKey=true))
	private int pid;
	@SQLType(dbtype="varchar2(20)")
	private String pname;
	@SQLType(dbtype="numeric(10,2)",constraints=@Constraints)
	private String price;

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public String getPname() {
		return pname;
	}

	public void setPname(String pname) {
		this.pname = pname;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + pid;
		result = prime * result + ((pname == null) ? 0 : pname.hashCode());
		result = prime * result + ((price == null) ? 0 : price.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Product other = (Product) obj;
		if (pid != other.pid)
			return false;
		if (pname == null) {
			if (other.pname != null)
				return false;
		} else if (!pname.equals(other.pname))
			return false;
		if (price == null) {
			if (other.price != null)
				return false;
		} else if (!price.equals(other.price))
			return false;
		return true;
	}


	public Product() {
		super();
	}

	public Product(int pid, String pname, String price) {
		super();
		this.pid = pid;
		this.pname = pname;
		this.price = price;
	}

	@Override
	public String toString() {
		return pid+"\t"+pname+"\t"+price;
	}
}
